package com.lanmaoly.cunzheng;

import com.lanmaoly.cunzheng.behavior.FlyBehavior;
import com.lanmaoly.cunzheng.behavior.QuackBehavior;

/**
 * 鸭子超类
 *
 * @author hou 2018-10-16 14:45:41
 */
public abstract class Duck {

    public FlyBehavior flyBehavior;
    public QuackBehavior quackBehavior;

    public Duck() {
    }

    /**
     * 展示
     */
    public abstract void dispaly();

    public void performFly() {
        flyBehavior.fly();
    }

    public void performQuack() {
        quackBehavior.quack();
    }

    public void swim() {
        System.out.println("我正在华丽丽的游泳....");
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }
}
